
import { enum_all_methods, enum_all_fields, enum_obj_fields } from '../common/dev.js'

function test() {
  // hook_activity();

  //$InnerClasses 这个表示 类中 InnerClasses类
  // var class_name = "com.facebook.login.LoginClient$Result";
  // var class_name = "com.facebook.login.LoginResult";
  var class_name = "com.example.myapplication.FridaTest";
  enum_all_methods(class_name);
  enum_all_fields(class_name)
  var InnerClass = Java.use(class_name);
  InnerClass['toString2'].implementation = function () {
    // console.log('toString() called');
    // return 'Hello World!';
    console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> enter toString2')
    console.log('enum_obj_fields', enum_obj_fields(this))
    return this.toString();
  };
}

globalThis.test = test;
globalThis.t = function() {
  Java.perform(function () {
    try {
      test();
    } catch (error) {
      console.error('error:', error)
    }
  });
};

console.log('test.js loaded')
globalThis.t()
